home *** CD-ROM | disk | FTP | other *** search
- /* routines to delete and/or rename files ... 871203-... ^z
- * part of the mergeIndices project.... mods 871230 by ^z for XFCN...
- */
-
- #include "mergeIndices.z.h"
-
- extern Str255 fn[3][3];
- extern int vRef[3][3], refNum[3][3];
- extern long first_text_file_size;
-
- /* delete the now-unneeded key and pointer files so that there will
- * be more room on disk ...(or give the user the option to keep them
- * if so desired?? -- maybe someday!) .... keep going after an error,
- * but give some warnings to the user....
- */
-
- int delete_old_key_and_ptr_files ()
- {
- give_msg ("\pDeleting old key & ptr dataspace files...");
- if (FSClose (refNum[MERGEDOUT][KEYFILE]) != noErr)
- {
- give_msg ("\pError closing merged key file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[MERGEDOUT][KEYFILE] = 0;
- if (FSClose (refNum[MERGEDOUT][PTRFILE]) != noErr)
- {
- give_msg ("\pError closing merged ptr file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[MERGEDOUT][PTRFILE] = 0;
- if (FSClose (refNum[FIRSTIN][KEYFILE]) != noErr)
- {
- give_msg ("\pError closing first key file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[FIRSTIN][KEYFILE] = 0;
- if (FSDelete (fn[FIRSTIN][KEYFILE], vRef[FIRSTIN][KEYFILE]) != noErr)
- {
- give_msg ("\pError deleting first key file! -- click mouse to continue...");
- beepWait ();
- }
- if (FSClose (refNum[FIRSTIN][PTRFILE]) != noErr)
- {
- give_msg ("\pError closing first ptr file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[FIRSTIN][PTRFILE] = 0;
- if (FSDelete (fn[FIRSTIN][PTRFILE], vRef[FIRSTIN][PTRFILE]) != noErr)
- {
- give_msg ("\pError deleting first ptr file! -- click mouse to continue...");
- beepWait ();
- }
- if (FSClose (refNum[SECONDIN][KEYFILE]) != noErr)
- {
- give_msg ("\pError closing second key file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[SECONDIN][KEYFILE] = 0;
- if (FSDelete (fn[SECONDIN][KEYFILE], vRef[SECONDIN][KEYFILE]) != noErr)
- {
- give_msg ("\pError deleting second key file! -- click mouse to continue...");
- beepWait ();
- }
- if (FSClose (refNum[SECONDIN][PTRFILE]) != noErr)
- {
- give_msg ("\pError closing second ptr file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[SECONDIN][PTRFILE] = 0;
- if (FSDelete (fn[SECONDIN][PTRFILE], vRef[SECONDIN][PTRFILE]) != noErr)
- {
- give_msg ("\pError deleting second ptr file! -- click mouse to continue...");
- beepWait ();
- }
-
- return (1);
- }
-
-
- int delete_and_rename_text_files ()
- {
- give_msg ("\pDeleting and renaming text dataspace files...");
- if (FSClose (refNum[SECONDIN][TEXTFILE]) != noErr)
- {
- give_msg ("\pError closing second text file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[SECONDIN][TEXTFILE] = 0;
- if (FSDelete (fn[SECONDIN][TEXTFILE], vRef[SECONDIN][TEXTFILE])
- != noErr)
- {
- give_msg ("\pError deleting second text file! -- click mouse to continue...");
- beepWait ();
- }
- if (FSClose (refNum[FIRSTIN][TEXTFILE]) != noErr)
- {
- give_msg ("\pError closing merged text file! -- click mouse to continue...");
- beepWait ();
- }
- refNum[FIRSTIN][TEXTFILE] = 0;
- if (Rename (fn[FIRSTIN][TEXTFILE], vRef[FIRSTIN][TEXTFILE],
- fn[MERGEDOUT][TEXTFILE]) != noErr)
- {
- give_msg ("\pError renaming merged text file! -- click mouse to continue...");
- beepWait ();
- }
-
- return (1);
- }
-
-
-